<template>
  <div>
    <div class="title">
      <div
        @click="back"
        class="back"
      >
        <div
          class="return"
          v-show="isBackShow"
        >
          <i class="el-icon-arrow-left"></i>
          返回
        </div>
      </div>
      <span class="content">{{title}}</span>
      <div
        class="tag"
        @click="set"
      >
        <i
          class="el-icon-setting"
          v-show="isSetting"
        ></i>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      isBackShow: true,
      isSetting: false
    };
  },
  created() {
    if (this.$route.path.includes("/home/me")) {
      this.isBackShow = false;
    }
  },
  methods: {
    back() {
      if (this.isBackShow) {
        this.$router.back(-1);
      }
    },
    set() {
      // console.log("22");
      if (this.isSetting) {
        this.$router.push({
          path: "/home/setting"
        });
      }
    }
  },
  props: {
    // 标题属性必传，
    title: {
      type: [String],
      default: "标题"
    },
    // more属性，属性值不用传
    more: {
      type: [String],
      default: ""
    }
  }
};
</script>
<style lang="less" scoped>
.title {
  width: 100%;
  height: 40px;
  line-height: 40px;
  text-align: center;
  background-color: #26a2ff;
  color: white;

  .back {
    width: 55px;
    float: left;
    border-radius: 10px;
    height: 40px;
    margin-left: 5px;
    text-align: center;
    line-height: 42px;
  }
  .tag {
    float: right;
    width: 55px;
    height: 40px;
    line-height: 40px;
    font-size: 24px;
  }
}
</style>